#ifdef USING_PCH
#	include "pch.h"
#else
#ifdef HAVE_CONFIG_H
#	include <config.h>
#endif

#include <synfig/localization.h>
#include <synfig/general.h>

#include <synfig/time.h>
#include <synfig/context.h>
#include <synfig/canvas.h>
#include <synfig/value.h>
#include <synfig/paramdesc.h>

#include "freetime.h"

#endif

using namespace std;
using namespace etl;
using namespace synfig;
using namespace modules;
using namespace lyr_std;

SYNFIG_LAYER_INIT(Layer_FreeTime);
SYNFIG_LAYER_SET_NAME(Layer_FreeTime, "freetime");
SYNFIG_LAYER_SET_LOCAL_NAME(Layer_FreeTime, N_("Free Time"));
SYNFIG_LAYER_SET_CATEGORY(Layer_FreeTime, N_("Time"));
SYNFIG_LAYER_SET_VERSION(Layer_FreeTime, "0.1");
SYNFIG_LAYER_SET_CVS_ID(Layer_FreeTime, "$Id$");

Layer_FreeTime::Layer_FreeTime()
{
    param_time = ValueBase(Time(0));

    SET_INTERPOLATION_DEFAULTS();
    SET_STATIC_DEFAULTS();
}

Layer_FreeTime::~Layer_FreeTime()
{ }

bool
Layer_FreeTime::set_param(const String &param, const ValueBase &value)
{
    IMPORT_VALUE(param_time);
    return Layer::set_param(param, value);
}

ValueBase
Layer_FreeTime::get_param(const String & param)const
{
    EXPORT_VALUE(param_time);
    EXPORT_NAME();
    EXPORT_VERSION();
    return Layer::get_param(param);
}

Layer::Vocab
Layer_FreeTime::get_param_vocab()const
{
    Layer::Vocab ret(Layer::get_param_vocab());

    ret.push_back(ParamDesc("time")
                  .set_local_name(_("Time"))
                  .set_description(_("Current time for next layers"))
                 );

    return ret;
}

void
Layer_FreeTime::set_time_vfunc(IndependentContext context, Time /* t */)const
{
    context.set_time(param_time.get(Time()));
}